#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char *itob(int integer, int size);

int main (int argc, char *argv[]) {
	int size, integer;
	char *binary;

	integer = atoi(argv[1]);
	size = atoi(argv[2]);
	
	binary = itob(integer,size);
	printf("%s\n", binary);
  return 0;
}

char *itob(int integer, int size){
	int i,masc;
	char *bin;
	
	bin = (char*) malloc (sizeof(char)*size);
	
	strcpy(bin,"");
	
	for(i = 0;(size !=0) && (i < sizeof(int)*8); i++){
		masc=pow(2,(size-1));
		if(integer & masc)
			strcat(bin,"1");
		else
			strcat(bin,"0");
		size--;
	}
	return bin;
}